/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React, { useState } from 'react';
import type { ChargeSustainIndexType } from '../types/ChargeSustain';
import { Tabs } from 'antd';
const { TabPane } = Tabs;
import ChargeSustainC from './ChargeSustainC';
import ChargeSustainS from './ChargeSustainS';

const ChargeSustain = (props: ChargeSustainIndexType) => {
  const { screenSize } = props;
  const [activeKey, setActiveKey] = useState('charge');
  const handleTabChange = (key: string) => setActiveKey(key);

  const tabList = [
    {
      tab: '充值查询',
      key: 'charge',
      child: <ChargeSustainC activeKey={activeKey} screenSize={screenSize} />,
    },
    {
      tab: '提现查询',
      key: 'sustain',
      child: <ChargeSustainS activeKey={activeKey} screenSize={screenSize} />,
    },
  ];

  return (
    <Tabs onChange={handleTabChange} activeKey={activeKey}>
      {tabList.map(({ child, ...rest }) => (
        <TabPane key={rest.key} tab={rest.tab} forceRender>
          {child}
        </TabPane>
      ))}
    </Tabs>
  );
};

export default ChargeSustain;
